import request from '@/utils/request'
import API from './constants'

/**
 * 查询首页轮播图数据
 */
export const getBanners = () => request({
  url: API.TAB_API + '/1',
  method: 'GET',
  headers: {
    'x-platform': 'pc',
  },
}).then(data => data.banners)
// data => data.banners  等价于 function(data) { return data.banners }

/**
 * 分页查询爆款商品
 * @param {*} start 起始索引
 * @returns
 */
export const getBaokuan = (start = 0) => request({
  // url: API.BAOKUAN_API + '?start=' + start,
  url: API.BAOKUAN_API,
  method: 'GET',
  params: { // `params` 是即将与请求一起发送的 URL 参数
    start,
  },
})
